﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel.DataAnnotations;

namespace CommunitySystem.Model.Silverlight
{
    public class MenuItem : DataEntity
    {
        private int _ID = 0;
        
        public int ID
        {
            get { return _ID; }
            set
            {
                if (_ID != value)
                {
                    _ID = value;
                    Validate("ID", value, this);
                };
            }
        }

        private string _Title = null;
       
        [Required(ErrorMessage = "菜单名称必填")]
        public string Title
        {
            get { return _Title; }
            set
            {
                if (_Title != value)
                {
                    _Title = value;
                    Validate("Title", value, this);
                };
            }
        }

        private bool _IsDefault = false;

        public bool IsDefault
        {
            get { return _IsDefault; }
            set
            {
                if (_IsDefault != value)
                {
                    _IsDefault = value;
                    Validate("IsDefault", value, this);
                }
            }
        }
        

        private string _Target = string.Empty;
        
        public string Target
        {
            get { return _Target; }
            set
            {
                if (_Target != value)
                {
                    _Target = value;
                    Validate("Target", value, this);
                };
            }
        }

        private int _Index = 0;
       //[NumberValidation(ErrorMessage="必须输入数字")]
        [Display(Name = "Index", Description = "只能输入数字")]
        public int Index
        {
            get { return _Index; }
            set
            {
                if (_Index != value)
                {
                    _Index = value;
                    Validate("Index", value, this);
                };
            }
        }

        private int _PID = 0;
        
        public int PID
        {
            get { return _PID; }
            set
            {
                if (_PID != value)
                {
                    _PID = value;
                    Validate("PID", value, this);
                };
            }
        }

        private byte[] _icon = null;
       
        public byte[] icon
        {
            get { return _icon; }
            set
            {
                _icon = value;
                Validate("icon", value, this);
            }
        }
    }
}
